package com.sh;

import com.sh.bean.User;
import com.sh.util.LinkStack;
import com.sh.util.SequenceStack;

import java.util.Stack;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class Main {
    public static void main(String[] args) {

        // 顺序栈
        SequenceStack<User> objectSequenceStack = new SequenceStack<>(3);
        User user1 = new User();
        user1.setName("user1");
        User user2 = new User();
        user2.setName("user2");
        objectSequenceStack.push(user1);
        objectSequenceStack.push(user2);
        System.out.println(objectSequenceStack.size());
        objectSequenceStack.show();
        System.out.println("=================");
        System.out.println(objectSequenceStack.peek());
        System.out.println(objectSequenceStack.isEmpty());
        System.out.println(objectSequenceStack.size());
        System.out.println(objectSequenceStack.pop());
        System.out.println(objectSequenceStack.size());
        System.out.println(objectSequenceStack.clear());
        System.out.println(objectSequenceStack.size());

        System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
        // 链栈

        LinkStack<User> linkStack = new LinkStack<>();
        User user3 = new User();
        user3.setName("user3");
        User user4 = new User();
        user4.setName("user4");
        System.out.println(linkStack.push(user3));
        System.out.println(linkStack.push(user4));
        System.out.println(linkStack.size());
        linkStack.show();
        System.out.println("=================");
        System.out.println(linkStack.peek());
        System.out.println(linkStack.isEmpty());
        System.out.println(linkStack.size());
        System.out.println(linkStack.pop());
        System.out.println(linkStack.size());
        System.out.println(linkStack.clear());
        System.out.println(linkStack.size());
    }
}

